Skip to main content
Version: 6.0.0-beta.3 - 6.0.0-beta.4

getEventsByTransactionID()

Query events by transactionID.

Usage

const events = await tronWeb.event.getEventsByTransactionID(
    txID,
    options
  );

Parameters

ParametersParameter DescriptionType
txIDtxID in hex without '0x'String
optionsOptional.See the following.

The type of options:

interface GetEventResultOptions {
  /**
   * Only query unconfirmed transaction events.
   * Default is false.
   */
  only_unconfirmed?: boolean;
  /**
   * Only query confirmed transaction events.
   * Default is false.
   */
  only_confirmed?: boolean;
}

Return

Standard events query result

Example

const events = await tronWeb.event.getEventsByTransactionID(
    '028f0565c1fefc6790da474c32fcfe42769d4317e20fdfad521fd3007684d6d3',
    { only_confirmed: true }
  );
console.log(events);
{
    "data": [
        {
            "block_number": 39025446,
            "block_timestamp": 1691146032000,
            "caller_contract_address": "TRz7J6dD2QWxBoumfYt4b3FaiRG23pXfop",
            "contract_address": "TRz7J6dD2QWxBoumfYt4b3FaiRG23pXfop",
            "event_index": 0,
            "event_name": "Transfer",
            "result": {
                "0": "0x573708726db88a32c1b9c828fef508577cfb8483",
                "1": "0x7b550beadccf4c92b8b4772a993e34f5afaa6eb6",
                "2": "5000000000000000000",
                "from": "0x573708726db88a32c1b9c828fef508577cfb8483",
                "to": "0x7b550beadccf4c92b8b4772a993e34f5afaa6eb6",
                "value": "5000000000000000000"
            },
            "result_type": {
                "from": "address",
                "to": "address",
                "value": "uint256"
            },
            "event": "Transfer(address indexed from, address indexed to, uint256 value)",
            "transaction_id": "028f0565c1fefc6790da474c32fcfe42769d4317e20fdfad521fd3007684d6d3"
        }
    ],
    "success": true,
    "meta": {
        "at": 1700727510461,
        "page_size": 1
    }
}